package com.chinasofti.bufferedio;

public class MathDemo {
    public static void main(String[] args) {
        int abs = Math.abs(-10);//返回一个数的绝对值
        System.out.println(abs);


       double ceil= Math.ceil(10.1);
        System.out.println("ceil="+ceil);//向上取整数

        double floor=Math.floor(10.1);
        System.out.println("floor="+floor);//向下取整数

        //四舍五入
        long round1 =Math.round(1.9);
        System.out.println("round1="+round1);
        long round2 =Math.round(1.4);
        System.out.println("round1="+round2);

        //返回两个数的最大值
        int max =Math.max(10, 20);
        System.out.println("max="+max);
        //返回两个数的最小值
        int min=Math.min(20, 30);
        System.out.println("min="+min);
        //返回a的b次幂
       double pow=Math.pow(2, 3);
        System.out.println("pow="+pow);
        //返回[0,1)
        for (int i = 0; i < 10; i++) {
            double random=Math.random();
            System.out.println("random="+random);
        }
    }
}
